<%@ page import="com.ydgk.bean.Admin" %><%--
  Created by IntelliJ IDEA.
  User: zzz
  Date: 2019/10/4
  Time: 16:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link rel="stylesheet" type="text/css" href="css/login.css">
</head>

<body>
<div class="htmleaf-container">
    <div class="wrapper">
        <div class="container">
            <h2>图书管理系统</h2>

            <form class="form" action="LoginServlet.action" method="get">
                <input type="text" placeholder="♟ 账号" name="aname">
                <input type="password" placeholder="✎ 密码" name="apass">
                <button type="submit" id="login-button" style="font-family: 方正喵呜体;">☌ 登录</button>
            </form>
        </div>

        <ul class="bg-bubbles">
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
    </div>
</div>

<%
   String message = (String)request.getAttribute("message");
    String aname = (String) request.getAttribute("aname");
%>
<script src="js/jquery-2.1.1.min.js" type="text/javascript"></script>
<script>
    $('#login-button').click(function (event) {
        event.preventDefault();
        $('form').fadeOut(500);
        $('.wrapper').addClass('form-success');
        $('h2').text('─=≡Σ(((つ•̀ω•́)つ  登录中...');
        setTimeout(function(){
            $('form').submit();
        },1300);
    });

    if(<%= message!=null%>){
         if("<%=message%>"=="success"){
             $('form').hide();
             $('.wrapper').addClass('form-success');
             $('h2').text('亲爱的<%= aname%>,欢迎您! (^_−)☆');
             setTimeout(function(){
                 window.location.href='main.jsp?aname=<%= aname%>';
             },2000);
         }else if("<%=message%>"=="ApassFailed"){
             $('form').hide();
             $('.wrapper').addClass('form-success');
             $('h2').text('密码错了哦! !!!∑(ﾟДﾟノ)ノ');
             setTimeout(function(){
                 $('form').show();
                 $('.wrapper').removeClass('form-success');
                 $('h2').text('图书管理系统');
             },2000);
         }else if("<%=message%>"=="AnameFailed"){
             $('form').hide();
             $('.wrapper').addClass('form-success');
             $('h2').text('∑(っ°Д°;)っ卧槽,账号错了!');
             setTimeout(function(){
                 $('form').show();
                 $('.wrapper').removeClass('form-success');
                 $('h2').text('图书管理系统');
             },2000);
         }
    }
</script>
</body>
</html>
